class UserThing < ActiveRecord::Base
  belongs_to :user, :counter_cache => true
  belongs_to :thing, :counter_cache => true  
  
  #create mapping relation between user and thing
  def UserThing.create_mapping(pUserId, pThingId, pStatus)
    logger.debug "======create the mapping relation between users and things"
    
    the_user_thing = UserThing.new
    #the_current_user.users_things << the_user_thing
    #the_thing.users_things << the_user_thing
    the_user_thing.user_id = pUserId
    the_user_thing.thing_id = pThingId
    the_user_thing.status = pStatus
    the_user_thing.create_at = Time.now
    the_user_thing.update_at = Time.now
    
    the_user_thing.save
  end
end
